#include <iostream>

using namespace std;
const int N=1e6+10;

int a[N];
int n,aim;

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	cin>>aim;
	int left=0,right=n-1;
	while(left<right)
	{
		int mid=left+right>>1;
		if(a[mid]<aim)
		{
			left=mid+1;
		}
		else{
			right=mid;
		}
	}
	cout<<(a[n-1]<aim?-1:left+1)<<endl;
	return 0;
}
